<?php
//NÃ£o mostra as mensagens de alerta
$display_success = $display_error = "style='display: none'";

if($has_alert != FALSE){

    if($msg_type == "success")
        $display_success = ''; //mostrar mensagem de sucesso
    else
        $display_error = ''; // mostrar mensagem de erro
}

?>
<script type="text/javascript" src="assets/js/locais/locais.js" charset="utf-8"></script>
<div class="container">
	<h3 class="text-info">Locais</h3>
	<div class="alert alert-error fade in" <?php echo $display_error;?>>
        <button type="button" class="close" data-dismiss="alert"><i class="icon-remove"></i> </button>
        <strong>Alerta</strong>
        <p><?php echo $alert_msg;?></p>
    </div>
    
    <div class="alert alert-success fade in" <?php echo $display_success;?> >
        <button type="button" class="close" data-dismiss="alert"><i class="icon-remove"></i> </button>
        <strong>Alerta</strong>
        <p><?php echo $alert_msg;?></p>
    </div>
        
	<div class="span3">
		<h4 class="muted">Categorias</h4>
		<p><a href="#nova_categoria_modal" data-toggle="modal"><span class="label label-info"><i class="icon-white icon-plus"></i> Nova categoria</a></span></p>		
		
		<ul class="nav nav-tabs nav-stacked">
		    <?php foreach($categoria_local as $categoria){?>
      			<li onclick="get_local_por_categoria(this,'<?php echo $categoria->categoria_id?>');" ><a><?php echo $categoria->categoria_nome; ?> <i class="icon-chevron-right pull-right"></i></a></li>
      		<?php } ?>
		</ul>
	
	</div>
	<div class="span7">
		<h4 class="muted">Titulo da categoria</h4>
		<p><a href="#novo_local_modal" data-toggle="modal"><span class="label label-info"><i class="icon-white icon-plus"></i> Novo local</span></a> <a href="#editar_categoria_modal" data-toggle="modal"><span class="label label-info"><i class="icon-white icon-refresh"></i> Editar categoria</span></a> <a href="#excluir_categoria_modal" data-toggle="modal"><span class="label label-info"><i class="icon-white icon-remove"></i> Excluir categoria</span></a></p>
	</div>
	
	<div id="local-info-container">
	    
	</div>
</div>
<!-- MODAL EXCLUIR LOCAL -->
<div class="modal fade" id="excluir_local_modal" style="display: none">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h3 class="modal-title muted">Exluir Local</h3>
      </div>
      <div class="modal-body">
          <span id="modal-text">Deseja mesmo exluir o local?</span>
          <form method="post" action="index.php/places/locais/excluir_local">
              <input type="hidden" name="local" id="excluir-local"/>
            <hr>
            <label><button type="submit" class="btn btn-success" id="confirma-excluir">Confirma</button>
            <button type="reset" class="btn btn-danger" onclick="fechar_modal('excluir_categoria_modal')">Cancelar</button>  </label>
         </form>
    
      </div>
      <div class="modal-footer">
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->